package com.example.tao.smartcar;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

public class BaseActivity extends AppCompatActivity {
    protected SmartCarApplication app = null;

    private Toolbar mToolbar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        app = (SmartCarApplication) getApplication();
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void onStart() {
        super.onStart();
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    protected void setToolbar(String title, boolean canBack) {
        mToolbar = (Toolbar) findViewById(R.id.custom_toolbar);
        Log.d("ZZ", "setToolbar");
        if (title == null || title.length() == 0) {
            mToolbar.setTitle(getResources().getString(R.string.app_name));
        } else {
            mToolbar.setTitle(title);
        }

        setSupportActionBar(mToolbar);
        //getSupportActionBar().setDisplayHomeAsUpEnabled(canBack);
    }

    protected Toolbar getToolbar() {
        return mToolbar;
    }
}
